<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>雍禾植发1</title>
    <script src="js/jquery.min.js"></script>
    <script src="js/rem.js"></script>
    <link rel="stylesheet" href="css/reset.css">
    <link rel="stylesheet" href="css/index.css">
</head>
<body>
<div class="footer" onclick="msgGet();"
     style="width: 100%;height: 1.2rem;line-height: 1.2rem;text-align: center;background-color: #fff;color: #fff;font-size: 0.36rem;vertical-align: middle;white-space: nowrap;letter-spacing: 1px;position: fixed;bottom: 0; left: 50%;transform: translateX(-50%);max-width: 640px;">
    <span style="float: left;width: 30%;color: #333;font-size: 0.28rem;">在线咨询</span>
    <div style="float: left;;width: 70%;color: #fff;background: rgba(78, 144, 255, 1);">免费领取毛囊检测</div>
</div>
<script>
    //点击去留资div
    var msgGet = function () {
        //animate动画效果
        $("html,body").animate({
            scrollTop: ($('.ao').eq(0).offset().top - 10) + "px"
        }, 500);
    }
</script>

<div class="box">
    <img src="images/img1.png">
    <img src="images/img2.gif">
    <p class="littleTitle">
        测一测您的头发问题 0元毛囊检测<br>
        免费获取植发报价
    </p>
    <div class="des">
        <img src="images/horn.png" height="200" width="200"/>
        <p>截止目前已有 <b style="color: #D0021B;font-weight: bolder;">8615</b>人参与活动</p>
    </div>

    <!-- 问题 -->
    <div class="ao">
        <div class="circlebox" id="sexbox">
            <label>您的性别？ <i>*</i> </label><br/>
            <span><b></b><input type="radio" name="msg_sex" value="男">男</span>
            <span><b></b><input type="radio" name="msg_sex" value="女">女</span>
        </div>


        <div class="circlebox" id="agebox">
            <label>您的年龄？<i style="color: #999;">(单选)</i><i>*</i></label><br/>
            <span><b></b><input type="radio" name="msg_age" value="18-25岁">18-25岁</span>
            <span><b></b><input type="radio" name="msg_age" value="26-35岁">26-35岁</span>
            <span><b></b><input type="radio" name="msg_age" value="36-45岁">36-45岁</span>
            <span><b></b><input type="radio" name="msg_age" value="46-55岁">46-55岁</span>
            <span><b></b><input type="radio" name="msg_age" value="55+">55+</span>
        </div>

        <div class="checkbox" id="hairQuestionbox">
            <label>您的头发有什么问题？<i style="color: #999;">(多选)</i><i>*</i></label>
            <span><b class="check"></b><input type="checkbox" name="msg_q" value="脱发/掉发">脱发/掉发</span>
            <span><b class="check"></b><input type="checkbox" name="msg_q" value="鬓角/美人尖">鬓角/美人尖</span>
            <span><b class="check"></b><input type="checkbox" name="msg_q" value="脱发→头发稀疏">脱发→头发稀疏</span>
            <span><b class="check"></b><input type="checkbox" name="msg_q" value="遗传→头发稀疏">遗传→头发稀疏</span>
            <span><b class="check"></b><input type="checkbox" name="msg_q" value="脱发→发际线后移">脱发→发际线后移</span>
            <span><b class="check"></b><input type="checkbox" name="msg_q" value="脱发→前额发量少">脱发→前额发量少</span>
        </div>
        <div>
            <label>姓名：<i>*</i></label>
            <input type="text" value="" name="msg_name" class="msg_name" required="required"
                   placeholder="已加密，请放心填写">
        </div>
        <div>
            <label>电话（已加密，便于接受优惠卷码）：<i>*</i></label>
            <input type="text" value="" name="msg_phone" class="msg_phone" required="required"
                   placeholder="已加密，请填写有效号码">
        </div>

        <div class="circlebox" id="booktime">
            <label>预约到店时间（根据距离就近安排门店，提前预约可享受到店优惠）？ <i>*</i> </label><br/>
            <span><b></b><input type="radio" name="msg_time" value="最近可安排">最近可安排</span>
            <span><b></b><input type="radio" name="msg_time" value="不确定">不确定</span>
        </div>


        <button type="button" class="btn" onclick="submitMsg(0);">获取植发报价</button>
    </div>

    <!-- 消息滚动轮播 -->
    <p class="title">最新报名客户</p>
    <div class="newsBox">
        <img src="images/fire.png" height="200" width="200"/>
        <div id="news1" class="news">
            <ul style="margin-top:0!important">
                <li>
                    <a href="">陈**</a><a href="">157****9518</a><a href="">4天前</a>
                </li>
                <li>
                    <a href="">王**</a><a href="">151****3775</a><a href="">4天前</a>
                </li>
                <li>
                    <a href="">张**</a><a href="">135****7296</a><a href="">4天前</a>
                </li>
                <li>
                    <a href="">林**</a><a href="">182****2433</a><a href="">3天前</a>
                </li>
                <li>
                    <a href="">朱**</a><a href="">137****3554</a><a href="">3天前</a>
                </li>
                <li>
                    <a href="">于**</a><a href="">157****9518</a><a href="">3天前</a>
                </li>
            </ul>
        </div>
    </div>

    <div class="tips">
        <p>掉发问题， <strong style="color: red">不能再【拖】了</strong></p>
        <p>马上预约0元头皮毛囊检测</p>
        <span>（活动限每日到店前20名，全国门店通用）</span>
    </div>

    <img src="images/img4.png"/>

    <!--<div class="tips">-->
    <!--温馨提示：填写信息不会产生任何费用，会有客服帮您安排预约，我们不会泄露您的个人信息。请您放心！-->
    <!--</div>-->


    <div class="ao">

        <div>
            <label>姓名：<i>*</i></label>
            <input type="text" value="" name="msg_name" class="msg_name" required="required"
                   placeholder="已加密，请放心填写">
        </div>
        <div>
            <label>电话：<i>*</i></label>
            <input type="text" value="" name="msg_phone" class="msg_phone" required="required"
                   placeholder="已加密，请填写有效号码">
        </div>
        <button type="button" class="btn" onclick="submitMsg(1);">免费获取脱发改善方案</button>

    </div>


    <img src="images/img3.png"/>


</div>
<div class="book" style="display: none">
    <img src="images/service.png" height="200" width="200"/>
    <span>毛发顾问01号为您服务</span>
    <div onclick="onKST();">在线咨询 <i>1</i></div>
</div>
<script>
    /* 多选点击 */

    $(".checkbox").find("span").each(function () {
        $(this).on("click", function () {
            var _b = $(this).find("b");
            _b.hasClass("checkActive") ? _b.removeClass("checkActive") : _b.addClass("checkActive");
        })
    })

    /* 单选点击 */

    $(".circlebox").find("span").each(function () {
        $(this).on("click", function () {
            var _b = $(this).find("b");
            _b.html("").addClass("circleActive").parent().siblings().find("b").removeClass("circleActive");
        })
    })


    /* 消息滚动轮播 */

    /* 消息滚动轮播 */
    function autoScroll(obj) {
        $(obj).find('ul').animate({
            marginTop: '-.60rem'
        }, 1000, function () {
            $(this).css({marginTop: "0px"});
            var _lis = $(obj).find("ul li");
            var _clone = _lis.first().clone();
            _lis.last().after(_clone);
            _lis.first().remove();
        })
    }


    $(function () {
        setInterval('autoScroll("#news")', 3000);
        setInterval('autoScroll("#news1")', 3000);
    })


    /*
    *
    * 织梦提交+赋值
    *
    * */
    var sex_a, age_a, hairQuestionstr = "", msg_name_a, msg_phone_a, linka_a, timea_a, option1a_a;
    var submitMsg = function (ind) {
        console.log(ind)

        var pass = false; //验证是否通过

        //姓名手机号必须验证
        function mustCheck(ind) {
            if ($("input[name=msg_name]").eq(ind).val() == '') {
                alert('请输入您的姓名');
                pass = false;
            }
            else if ($("input[name=msg_phone]").eq(ind).val() == '') {
                alert('请输入您的手机号');
                pass = false;
            }
            else if (!/^1[34578]\d{9}$/.test($("input[name=msg_phone]").eq(ind).val())) {
                alert('请输入正确的手机号');
                pass = false;
            }
            else {
                pass = true;
            }
        }

        if (ind == 0) {
            if ($('#sexbox').find(".circleActive").length < 1) {
                alert('请选择您的性别');
                pass = false;
            }
            else if ($('#agebox').find(".circleActive").length < 1) {
                alert('请选择您的年龄');
                pass = false;
            }
            else if ($('#hairQuestionbox').find(".checkActive").length < 1) {
                alert('请至少选择一个问题');
                pass = false;
            }
            else {
                mustCheck(ind);
            }
        } else {
            mustCheck(ind);
        }


        //性别
        $("#sexbox").find(".circleActive").each(function () {
            sex_a = $(this).next().val();
        });
        //年纪
        $("#agebox").find(".circleActive").each(function () {
            age_a = $(this).next().val();
        });
        //您的脱发症状
        $("#hairQuestionbox").find(".checkActive").each(function () {
            hairQuestionstr = hairQuestionstr + $(this).next().val() + "。";
        });
        //姓名 msg_name
        msg_name_a = $("input[name=msg_name]").eq(ind).val();
        //电话 msg_phone
        msg_phone_a = $("input[name=msg_phone]").eq(ind).val();
        //到店时间 option1
        $("#booktime").find(".circleActive").each(function () {
            option1a_a = $(this).next().val();
        });


        //表单提交时间
        function writeCurrentDate() {
            var now = new Date();
            var year = now.getFullYear(); //得到年份
            var month = now.getMonth();//得到月份
            var date = now.getDate();//得到日期
            var day = now.getDay();//得到周几
            var hour = now.getHours();//得到小时
            var minu = now.getMinutes();//得到分钟
            var sec = now.getSeconds();//得到秒
            var MS = now.getMilliseconds();//获取毫秒
            var week;
            month = month + 1;
            if (month < 10) month = "0" + month;
            if (date < 10) date = "0" + date;
            if (hour < 10) hour = "0" + hour;
            if (minu < 10) minu = "0" + minu;
            if (sec < 10) sec = "0" + sec;
            if (MS < 100) MS = "0" + MS;
            var arr_week = new Array("星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六");
            week = arr_week[day];
            var time = "";
            time = year + "年" + month + "月" + date + "日" + " " + hour + ":" + minu + ":" + sec;
            timea_a = time;
        }

        writeCurrentDate();

        //链接
        linka_a = window.location.href;

        var dataObj = {
            "action": 'post',// 定义提交的方式
            "diyid": 8,// 织梦自定义表单的id 百度信息流zxsf01
            "do": 2,// 织梦自定义表单的请求的返回形式
            "dede_fields": "sex,text;age,text;queation,text;name,text;phone,text;link,text;addtime,text;option1,text;option2,text;option3,text",// 织梦自定义表单的请求项目
            "dede_fieldshash": "4654a8e498ed74d45c56c0b58d16e0e8",// 织梦自定义表单的哈希编码
            "sex": sex_a,
            "age": age_a,
            "queation": hairQuestionstr,
            "name": msg_name_a,
            "phone": msg_phone_a,
            "link": linka_a,
            "addtime": timea_a,
            "option1": "",   //到店时间
            "option2": "",
            "option3": ""
        };
        // console.log(dataObj)

        if (pass) {
            $.ajax({
                url: 'http://wx.120zhifa.cn/plus/diy.php',
                data: dataObj,
                type: 'POST',
                contentType: 'application/x-www-form-urlencoded; charset=utf-8', // 必须设置，与接收数据后台编码保持一致
                header: {
                    Accept: "multipart/form-data; charset=utf-8" // 与接收数据后台编码保持一致
                },
                success: function (data) {
                    alert('您已预约成功，稍后会有专业人员联系您！');
                    window.scrollTo(0, 0);
                    window.location.reload();
                }
            })
        }


    }

</script>
</body>
</html>